<?php

class tplTutorListing extends StudyBuddy\Template\Template
{

	protected static function func(&$a) {
		//$subject = array('English', 'Maths', 'A Maths', 'Science', 'Physics', 'Chemistry', 'Biology', 'Geography', 'History', 'Literature'); 
		$subject = array('English', 'Malay', 'Chem', 'Science', 'Amaths', 'Geography');
		if(!empty($a['teach'])){
			$a['canTeach'] = '';
			$canteach = explode(',',$a['teach']);
			for($i = 0 ; $i < count($subject) ; $i++){
				for($j = 0 ; $j < 9; $j++){
					if($canteach[$j + ($i * 9)] == 1){
						if(!strpos($a['canTeach'], $subject[$i]) ){
							$a['canTeach'] .= $subject[$i].', ';
						}
					}
				}
            }
			$a['canTeach'] = substr($a['canTeach'], 0, -2);
		}
		if(empty($a['experience'])){
			$a['experience'] = '0';
		}
	}
	
	protected static $vars = array(
	'_id' => '0', //1
	'username' => '', //2
	'fullname' => '', //3
	'avtr' => '/images/avatar.png', //4
	'experience' => '0', //5
	'canTeach' => '', //6
	);

	protected static $tpl = '<li>
                                <div class="recent-img">
                                    <a href="/users/%1$s/%2$s"><img alt="" src="%4$s" width="31px"/></a>
                                </div>
                                <div class="recent-ct">
                                    <a href="/users/%1$s/%2$s"><span>%3$s</span> | exp. %5$s years %6$s</a>
                                </div>
                            </li>';
}